<!DOCTYPE html>  
<html>  
  <head>  
    <title>While Loop</title>  
  </head>
  <body>  
    <script type="text/javascript">  
       var i = 0;
       while (i < 5) {
         document.write(i);document.write("<br>");
         i++;
       }
       document.write("<hr>");
       
       i = 0;
       do {
         document.write(i);document.write("<br>");
         i++;
       } while (i < 5);
    </script> 
  </body>  
</html>